<?php

namespace Nim\Bundle\ModelBundle\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;

/**
 * Image
 *
 * @ORM\Table(name="image")
 * @ORM\Entity
 */
class Image
{
    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var string
     *
     * @ORM\Column(name="url", type="string", length=512)
     */
    private $url;

    /**
     * @var string
     *
     * @ORM\Column(name="name", type="string", length=50)
     */
    private $name;

    /**
     * @ORM\OneToMany(targetEntity="Page", mappedBy="image")
     */
    private $pages;
    
    /**
     * @ORM\ManyToOne(targetEntity="Campain", inversedBy="images")
     * @ORM\JoinColumn(name="campain_id")
     */
    private $campain;
    
    public function __construct()
    {
    	$this->pages = new ArrayCollection();
    }

    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set url
     *
     * @param string $url
     * @return Image
     */
    public function setUrl($url)
    {
        $this->url = $url;
    
        return $this;
    }

    /**
     * Get url
     *
     * @return string 
     */
    public function getUrl()
    {
        return $this->url;
    }

    /**
     * Set name
     *
     * @param string $name
     * @return Image
     */
    public function setName($name)
    {
        $this->name = $name;
    
        return $this;
    }

    /**
     * Get name
     *
     * @return string 
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Add pages
     *
     * @param \Nim\Bundle\ModelBundle\Entity\Page $pages
     * @return Image
     */
    public function addPage(\Nim\Bundle\ModelBundle\Entity\Page $pages)
    {
        $this->pages[] = $pages;
    
        return $this;
    }

    /**
     * Remove pages
     *
     * @param \Nim\Bundle\ModelBundle\Entity\Page $pages
     */
    public function removePage(\Nim\Bundle\ModelBundle\Entity\Page $pages)
    {
        $this->pages->removeElement($pages);
    }

    /**
     * Get pages
     *
     * @return \Doctrine\Common\Collections\Collection 
     */
    public function getPages()
    {
        return $this->pages;
    }

    /**
     * Set campain
     *
     * @param \Nim\Bundle\ModelBundle\Entity\Campain $campain
     * @return Image
     */
    public function setCampain(\Nim\Bundle\ModelBundle\Entity\Campain $campain = null)
    {
        $this->campain = $campain;
    
        return $this;
    }

    /**
     * Get campain
     *
     * @return \Nim\Bundle\ModelBundle\Entity\Campain 
     */
    public function getCampain()
    {
        return $this->campain;
    }
}